/**
 * yiqihao(一起好商务股份有限公司) copyright 
 */
package com.p2p.front.dal.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.p2p.base.dao.BaseMapper;
import com.p2p.front.dal.model.LoopNotice;

/**
 *
 * @author leiruiqi@yiqihao.com
 *
 * 2015年1月30日 上午9:07:02
 */
public interface LoopNoticeDao extends BaseMapper{

	@Insert("insert into p2p_loop_notice (uptime,info,createby,status) values(NOW(),#{info},#{createby},#{status})")
	void create(LoopNotice loopNotice);
	
	@Update("update p2p_loop_notice set info=#{info},updateby=#{updateby},status=#{status},uptime=NOW() where id=#{id}")
	int update(LoopNotice loopNotice);
	
	@Select("select id,info,uptime,createby,updateby,status from p2p_loop_notice where id= #{id}")
	public LoopNotice getById(Long id);
	
	@Delete("delete from p2p_loop_notice where id=#{id}")
	int delete(Long id);
	
	@Select("select id,info,uptime,createby,updateby,status from p2p_loop_notice where status=#{status} order by uptime desc limit #{limit}")
	List<LoopNotice> listAllByStatus(@Param("status") int status,@Param("limit")int limit);
	
	@Select("select id,info,uptime,createby,updateby,status from p2p_loop_notice order by uptime desc")
	List<LoopNotice> listAll();
}
